package com.zzu.chat.chat.detail.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.zzu.chat.R;
import com.zzu.chat.bean.Comment;

import java.util.LinkedList;

public class Comments_Adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    private LinkedList<Comment> comments;
    private Context context;
    public Comments_Adapter(LinkedList<Comment> comments, Context context){
        this.comments=comments;
        this.context = context;
    }

    @Override
    public int getItemViewType(int position) {
        return super.getItemViewType(position);
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.adapter_item_blink_detail_comments_pager1_item,parent,false);
        return new CommentsViewHolder(view);

    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        CommentsViewHolder commentsViewHolder = (CommentsViewHolder)holder;
        commentsViewHolder.comment.setText(comments.get(position).getCommentContent());
    }

    @Override
    public int getItemCount() {
        return comments.size();
    }

    class CommentsViewHolder extends RecyclerView.ViewHolder {

        private ImageView headImage;
        private TextView comment,time,name;

        public CommentsViewHolder(View ItemView) {
            super(ItemView);
            comment = ItemView.findViewById(R.id.tv_comment);
        }
    }
}
